package com.yimi.yinhepda.adapter.RecycleAdapter;

import android.content.Context;
import android.view.View;

import com.yimi.yinhepda.R;
import com.pda.ym.base.CommonRecycleAdapter;
import com.pda.ym.base.CommonViewHolder;
import com.yimi.yinhepda.entity.bean.StatForkliftTaskDetail;
import com.yimi.yinhepda.utils.Common;

import java.util.List;

/**
 * @author lj
 */
public class ForkliftAdapter extends CommonRecycleAdapter<StatForkliftTaskDetail> {

    private Context mContext;

    public ForkliftAdapter(Context context, List<StatForkliftTaskDetail> dataList, CommonViewHolder.onItemCommonClickListener commonClickListener) {
        super(context, dataList, R.layout.item_fork_lift);
        this.mContext = context;
    }

    @Override
    public void bindData(CommonViewHolder holder, StatForkliftTaskDetail data, int position) {
        holder.setText(R.id.tv_waybill, data.getWaybillNo());
        holder.setText(R.id.tv_areaCode, data.getAreaCode());
        holder.setText(R.id.tv_quality, data.getNum() + "");
        holder.setText(R.id.tv_next_station, data.getNextDept());
        View view = holder.itemView;
        if (data.isCheck()) {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.green));
        } else {
            view.setBackgroundColor(mContext.getResources().getColor(R.color.white));
        }

        //二级排序：获取产品类型
        int secondSort = data.getSecondSort();
        holder.setText(R.id.tv_produce_type, Common.getSecondType(secondSort));
    }
}
